
const express = require('express');
const router = new express.Router();

router.get('/forCommerceInvoice', async(req, res, next) => {
    const content = [];
    for(let i = 0; i < 100; i++)
        content.push({
            id: `2020${i}`,
            code: 'string',
            dealerCode: 'string',
            dealerName: 'string',
            saleConfirmationrCode: 'string',
            batchNumber: 'string',
            palletCode: 'string',
            packingType: 0,
            container: 'string',
            status: 0,
            length: 0,
            width: 0,
            height: 0,
            volume: 0,
            netWeight: 0,
            grossWeight: 0,
            createTime: '2020-03-16T07:12:39.089Z',
            currency: 1,
            totalAmount: 10,
            rowVersion: 'string',
            options: [
                'update',
                'close',
            ]
          
        });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 100,
        }
    });
});
router.get('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message',
        payload: {
            id: 'string2',
            code: 'string',
            dealerCode: 'string',
            dealerName: 'string',
            saleConfirmationrCode: 'string',
            batchNumber: 'string',
            packingType: 0,
            container: 'string',
            status: 0,
            length: 0,
            width: 0,
            height: 0,
            volume: 0,
            netWeight: 0,
            grossWeight: 0,
            createTime: '2020-03-16T07:12:39.089Z',
            rowVersion: 'rowVersion',
            options: [
                'update',
                'close',
            ],
            details: [
                {
                    id: 'string1',
                    serialNums: 'string',
                    palletCode: 'string',
                    kDBomCode: 'string',
                    kDBomVersionCode: 'string',
                    quantity: 0,
                    price: 0,
                    totalPrice: 0,
                    perNetWeight: 0,
                    netWeight: 0
                },
                {
                    id: 'string2',
                    serialNums: 'string',
                    palletCode: 'string',
                    kDBomCode: 'string',
                    kDBomVersionCode: 'string',
                    quantity: 0,
                    price: 0,
                    totalPrice: 0,
                    perNetWeight: 0,
                    netWeight: 0
                },
                {
                    id: 'string3',
                    serialNums: 'string',
                    palletCode: 'string',
                    kDBomCode: 'string',
                    kDBomVersionCode: 'string',
                    quantity: 0,
                    price: 0,
                    totalPrice: 0,
                    perNetWeight: 0,
                    netWeight: 0
                }
            ],
            attachments: [{
                fileId: 'te1232-131232-1we',
                fileName: '��װ����ͼ1'
            },
            {
                fileId: 'qww1-232131-12e',
                fileName: '��װ����ͼ2'
            }]
        }
    };
    res.json(data);
});

router.put('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
router.put('/:id/close', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});

router.post('/import', async(req, res, next) => {
    const options = {
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});

module.exports = router;
